//
//  SearchTableviewCell.m
//  HandWork
//
//  Created by 王阳阳 on 16/1/28.
//  Copyright © 2016年 www.lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "SearchTableviewCell.h"

@implementation SearchTableviewCell
- (void)dealloc
{
    [_title release];
    [_price release];
    [_sum release];
    [_img release];
    [super dealloc];
}
#pragma mark - 初始化
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self creat];
    }
    return self;
}
- (void)creat
{
    //图片
    self.img = [[UIImageView alloc]init];
    [self.contentView addSubview:self.img];
    [_img release];
    
    //标题
    self.title  = [[UILabel alloc]init];
    [self.contentView addSubview:self.title];
    [_title release];
    //价格
    self.price = [[UILabel alloc]init];
    [self.contentView addSubview:self.price];
    [_price release];
    
    //购买数量
    self.sum = [[UILabel alloc]init];
    [self.contentView addSubview:self.sum];
    [_sum release];
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    //图片
    self.img.frame = CGRectMake(5, 5, [UIScreen mainScreen].bounds.size.width / 5, [UIScreen mainScreen].bounds.size.width / 5);
    //标题
    self.title.frame = CGRectMake(self.img.frame.size.width + self.img.frame.origin.x + 5, 5, [UIScreen mainScreen].bounds.size.width - self.img.frame.size.width - 10, 60);
    self.title.numberOfLines = 0;
    self.title.font = [UIFont systemFontOfSize:14];

    //价格
    self.price.frame = CGRectMake(self.img.frame.size.width + self.img.frame.origin.x+5, self.title.frame.size.height + 10, [UIScreen mainScreen].bounds.size.width / 5, 30);
    self.price.font = [UIFont systemFontOfSize:12];
    self.price.textColor = [UIColor redColor];
    
    //个数
    self.sum.frame = CGRectMake([UIScreen mainScreen].bounds.size.width -([UIScreen mainScreen].bounds.size.width  / 5), self.title.frame.size.height + 10,[UIScreen mainScreen].bounds.size.width / 5 , 30);
    self.sum.font = [UIFont systemFontOfSize:12];
    self.sum.textColor = [UIColor redColor];

}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
